package com.tuo51.childcare.domain.ptest;

import com.tuo51.childcare.domain.vo.PTestItemOptionVO;
import com.tuo51.foudation.model.Domain;
import com.vladmihalcea.hibernate.type.json.JsonStringType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;

/**
 *
 */

@Entity
@Table(name = "user_ptest_item")
@EqualsAndHashCode(callSuper = true)
@Data
@TypeDef(name = "json", typeClass = JsonStringType.class)
public class PTestItem extends Domain {

    @Column(columnDefinition = " int default 0  COMMENT '当天序号'")
    private Integer dailyIndex;

    @Column(columnDefinition = " int default 0  COMMENT '宝宝第几天出这题'")
    private Integer forDay;

    @Column(columnDefinition = " int default 0  COMMENT '月龄底线'")
    private Integer monthMin;

    @Column(columnDefinition = " int default 99  COMMENT '月龄高限'")
    private Integer monthMax;

    @Column(columnDefinition = "varchar(128) COMMENT '题目标题'")
    private String title;

    @Column(columnDefinition = "varchar(32) COMMENT '分类id'")
    private String categoryId;

    public final static Integer ITEMTYPE_QUESTION = 0;
    public final static Integer ITEMTYPE_TIPS = 1;
    @Column(columnDefinition = " int DEFAULT 0 COMMENT '0. 问答型，  1. 知识型' ")
    private Integer itemType = ITEMTYPE_QUESTION;

    public final static Integer ANSWERTYPE_SINGLE = 1;
    public final static Integer ANSWERTYPE_MULTIPLE = 2;
    public final static Integer ANSWERTYPE_TEXT = 3;
    public final static Integer ANSWERTYPE_TOF = 4;
    @Column(columnDefinition = " int DEFAULT 1 COMMENT '答案类型, 1.单选， 2.多选，  3.文本， 4.判断' ")
    private Integer answerType;

    @Column(columnDefinition = " int DEFAULT 1 COMMENT '多选单选数量' ")
    private Integer multipleCount;

    @Type(type = "json")
    @Column(columnDefinition = "JSON COMMENT '选项：名称，分值，对应分值跳过的题目' ")
    private List<PTestItemOptionVO> options;

    @Column(columnDefinition = "varchar(1024) COMMENT '图片'")
    private String images;

    @Column(columnDefinition = "varchar(1024) COMMENT '视频'")
    private String videos;

    @Column(columnDefinition = "varchar(255) COMMENT '链接地址'")
    private String ref;

    @Column(columnDefinition = "varchar(255) COMMENT '提示'")
    private String hint;
}
